home *** CD-ROM | disk | FTP | other *** search
/ HTBasic 9.3 / HTBasic 9.3.iso / LgcyPlus / disk2 / STRGWDGT._ / STRGWDGT.
Encoding:
Text File  |  2001-03-02  |  1.2 KB  |  37 lines

  1. 10    ! ********************************************
  2. 20    ! Example: STRING Widget
  3. 30    !
  4. 40    ! This program generates a STRING widget and
  5. 50    ! allows the user to enter text from the keyboard.
  6. 60    ! The text entered by the user is displayed after
  7. 70    ! the Enter key is pressed. To exit the program,
  8. 80    ! type QUIT and press Enter OR click the PANEL icon
  9. 90    ! and then click Quit.
  10. 100   !
  11. 110   ! ********************************************
  12. 120   !
  13. 130   CLEAR SCREEN
  14. 140   DIM S$[255]
  15. 150   ASSIGN @String TO WIDGET "STRING"
  16. 160   CONTROL @String;SET ("TITLE":" Example: STRING Widget")
  17. 170   CONTROL @String;SET ("X":100,"Y":100,"COLUMNS":30)
  18. 180   CONTROL @String;SET ("VALUE":"Enter text here")
  19. 190   CONTROL @String;SET ("SYSTEM MENU":"Quit")
  20. 200   !
  21. 210   ON EVENT @String,"RETURN" GOSUB Handler
  22. 220   ON EVENT @String,"SYSTEM MENU" GOTO Finis
  23. 230   !
  24. 240   LOOP
  25. 250     WAIT FOR EVENT
  26. 260   END LOOP
  27. 270   !
  28. 280 Handler: !
  29. 290   STATUS @String;RETURN ("VALUE":S$)
  30. 300   CONTROL @String;SET ("VALUE":"")
  31. 310   IF S$="QUIT" THEN Finis
  32. 320   DISP "Text entered:",S$
  33. 330   RETURN
  34. 340 Finis: !
  35. 350   ASSIGN @String TO *        ! Delete STRING widget
  36. 360   END
  37.